<!-- ***************************************************************** -->
<chapter>
-<title>GTK+ FAQ</title>
-
-<!-- ----------------------------------------------------------------- -->
-
-<sect1>
<title>General Information</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Before anything else: the greetings</title>
<para>The FAQ authors want to thank:</para>
<itemizedlist spacing=Compact>
</listitem></itemizedlist>
<para> If we forgot you, please email us! Thanks again (I know,
it's really short :) </para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Authors</title>
<para>The original authors of GTK+ were:</para>
<para>Since then, much has been added by others. Please see the
AUTHORS file in the distribution for the GTK+ Team.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What is GTK+?</title>
<para>GTK+ is a small and efficient widget set designed with
the programmer desires. This flexibility is adhered to
throughout the library.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What is the + in GTK+?</title>
<para>Peter Mattis informed the gtk mailing list that:</para>
being an enhancement to the original gtk that adds object
oriented features.</quote></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Does the G in GTK+, GDK and GLib stand for?</title>
<para>GTK+ == Gimp Toolkit</para>
<para>GDK == GTK+ Drawing Kit</para>
<para>GLib == G Libray</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Where is the documentation for GTK+?</title>
<para>In the GTK+ distribution's doc/ directory you will find
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Is there a mailing list (or mailing list archive) for
GTK+?</title>
http://www.gtk.org/mailinglists.html
</ulink></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How to get help with GTK+</title>
<para>First, make sure your question isn't answered in the
sure you've done that, right? In that case, the best place to
post questions is to the GTK+ mailing list.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How to report bugs in GTK+</title>
<para>Bugs should be reported to the GNOME bug tracking system
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Is there a Windows version of GTK+?</title>
<para>There is an on going port of GTK+ to the Windows
http://www.iki.fi/tml/gimp/win32</ulink>
for more information.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What applications have been written with GTK+?</title>
<para>A list of some GTK+ based application can be found on
GTK+ based RAD tool which produces GTK+ applications</simpara>
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I'm looking for an application to write in GTK+. How
about an IRC client?</title>
</listitem>
</itemizedlist>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>How to find, configure, install, and troubleshoot GTK+</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What do I need to run GTK+?</title>
<para>To compile GTK+, all you need is a C compiler (gcc) and
the X Window System and associated libraries on your system.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Where can I get GTK+?</title>
<para>The canonical site is <ulink
ftp://ftp.insync.net/pub/mirrors/ftp.gimp.org</ulink></simpara>
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I configure/compile GTK+?</title>
<para>Generally, all you will need to do is issue the commands:</para>
<literal>make</literal></literallayout></para>
<para>in the gtk+-version/ directory.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>When compiling GTK+ I get an error like: <literal>make:
file `Makefile' line 456: Syntax error</literal></title>
out there, and not all of them handle the automatically
generated Makefiles.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I've compiled and installed GTK+, but I can't get any
programs to link with it!</title>
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>When compiling programs with GTK+, I get compiler error
messages about not being able to find
<literal>glibconfig.h</literal>.</title>
<para>(Substitute the appropriate value of $exec_prefix for
/usr/local.)</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>When installing a GTK+ application, configure reports
that it can't find GTK.</title>
with the line just above it in config.log. If the compilation is
successful, try executing it.</para>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>Development of GTK+</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Whats this CVS thing that everyone keeps talking about,
and how do I access it?</title>
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How can I contribute to GTK+?</title>
<para>It's simple. If something doesn't work like you think it
<para>Once you upload <emphasis>anything</emphasis>, send the README to
ftp-admin@gtk.org</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I know if my patch got applied, and if not, why
not?</title>
right. Don't be put off if your patch didn't make it first
time round.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What is the policy on incorporating new widgets into
the library?</title>
widgets that are generally useful, work, and are not a
disgrace to the widget set will gladly be included.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Is anyone working on bindings for languages other than
C?</title>
</listitem>
</itemizedlist>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>Development with GTK+: the begining</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I get started?</title>
<para>So, after you have installed GTK+ there are a couple of
distribution. Looking at these examples will give you a good
grounding on what the widgets can do.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I tried to compile a small <command>Hello World</command> of mine,
but it failed. Any clue?</title>
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What about using the <command>make</command>
utility?</title>
<para>For more information about the <command>make</command> utility, you
should read either the related man page or the relevant info file.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I use the backquote stuff in my makefiles, but my make
process failed.</title>
utility (get it on the GNU ftp server at <ulink
url="ftp://ftp.gnu.org/">ftp://ftp.gnu.org/</ulink>).</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I want to add some configure stuff, how could I do
this?</title>
really easy to understand, and there are plenty of web
resources that deal with autoconf and automake).</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I try to debug my GTK+ application with gdb, but it
hangs my X server when I hit some breakpoint. Any
Idea?</title>
terminals are dirt cheap but a bit hard to get (here in The
Netherlands, YMMV).</quote></para>
-</sect2>
</sect1>
+</chapter>
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>Development with GTK+: general questions</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What widgets are in GTK?</title>
<para>The GTK+ Tutorial lists the following widgets:</para>
+GtkHSeparator
`GtkVSeparator
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Is GTK+ thread safe? How do I write multi-threaded GTK+
applications?</title>
return(0);
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Why does this strange 'x io error' occur when I
<literal>fork()</literal> in my GTK+ app?</title>
exit(0);
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Why don't the contents of a button move when the button
is pressed? Here's a patch to make it work that way...</title>
<para><quote>On a more practical note, I did implement this at one point
and determined it didn't look good and removed it.</quote></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I identifiy a widgets top level window or other
ancestor?</title>
hbox = gtk_widget_get_ancestor(w, GTK_TYPE_HBOX);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I get the Window ID of a GtkWindow?</title>
<para>The actual Gdk/X window will be created when the widget
Window xwin = GDK_WINDOW_XWINDOW (GTK_WIDGET (my_window)->window);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I catch a double click event (in a list widget,
for example)?</title>
is going to be true for any toolkit, since computers aren't
good at reading one's mind.)</quote></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>By the way, what are the differences between signals
and events?</title>
than emitting a signal when you click a button makes button clicking and
signals related concepts.</quote></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Data I pass to the <literal>delete_event</literal> (or other event)
handler gets corrupted.</title>
gpointer data);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I have my signal connected to the the (whatever) event,
but it seems I don't catch it. What's wrong?</title>
<para>All the event masks are defined in the
<filename>gdktypes.h</filename> file.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I need to add a new signal to a GTK+ widget. Any
idea?</title>
classical gpointer parameter, you'll have to play with GTK+
marshallers.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Is it possible to get some text displayed which is
truncated to fit inside its allocation?</title>
want to copy gtkviewport.c and strip out the adjustment and
shadow functionality (perhaps you could call it
GtkClipper).</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I make my window modal? / How do I make a single
window active?</title>
<literal>gtk_grab_add(my_window)</literal>. And after closing the window
do <literal>gtk_grab_remove(my_window)</literal>.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Why doesn't my widget (e.g. progressbar)
update?</title>
and high priority idle functions, then return immediately
(the drawing is done in a high priority idle function).</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I attach data to some GTK+ object/widget?</title>
<para>First of all, the attached data is stored in the
is deprecated in 1.2. They only provide a compatibility mode
with some old gtk packages.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I remove the data I have attached to an
object?</title>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I reparent a widget?</title>
<para>The normal way to reparent (ie change the owner) of a
gtk_widget_unref(widget);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How could I get any widgets position?</title>
<para>As Tim Janik pointed out, there are different cases, and
Window Managers manage the decorations that they add around
windows.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I set the size of a widget/window? How do I
prevent the user resizing my window?</title>
x_size, y_size);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I add a popup menu to my GTK+ application?</title>
<para>The <literal>menu</literal> example in the examples/menu
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I disable or enable a widget, such as a
button?</title>
first parameter is you widget pointer. The second parameter is
a boolean value: when this value is TRUE, the widget is
enabled.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Shouldn't the text argument in the gtk_clist_*
functions be declared const?</title>
casting, but in the array case, it is not the array itself
that needs the (const) qualified cast, but its members, thus
changing the whole type.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I render pixels (image data) to the
screen?</title>
<para>You do NOT want to use
<literal>gdk_draw_point()</literal>, that will be extremely
slow.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I create a pixmap without having my window being
realized/shown?</title>
gdk_pixmap_unref (pixmap_mask);
</programlisting>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>Development with GTK+: widget specific questions</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I find out about the selection of a GtkList?</title>
<para>Get the selection something like this:</para>
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I stop the column headings of a GtkCList
disappearing when the list is scrolled?</title>
gtk_container_add(GTK_CONTAINER(scrolled), clist);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I don't want the user of my applications to enter text
into a GtkCombo. Any idea?</title>
<para>Set the editable parameter to FALSE to disable typing
into the entry.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I catch a combo box change?</title>
<para>The entry which is associated to your GtkCombo send a
NULL);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How can I define a separation line in a menu?</title>
<para>See the <ulink
gtk_widget_show(menuitem);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How can I right justify a menu, such as Help?</title>
<para>Depending on if you use the MenuFactory or not, there
gtk_menu_item_right_justify(my_menu_item);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I add some underlined accelerators to menu
items?</title>
gtk_container_add (GTK_CONTAINER (file1_menu), new1);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How can I retrieve the text from a GtkMenuItem?</title>
<para>You can usually retrieve the label of a specific
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I right (or otherwise) justify a
GtkLabel?</title>
gtk_misc_set_alignment(GTK_MISK(label), 1.0f, 1.0f);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I set the background color of a GtkLabel
widget?</title>
a GtkLabel widget, you need to change the background color of
its parent, i.e. the object that you pack it into.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I set the color and font of a GtkLabel using a
Resource File?</title>
gtk_widget_show(label);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I configure Tooltips in a Resource File?</title>
<para>The tooltip's window is named "gtk-tooltips",
widget "gtk-tooltips*" style "postie"
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>I can't add more than (something like) 2000 chars in a
GtkEntry. What's wrong?</title>
max_length = MIN (2047, entry->text_max_length);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I make a GtkEntry widget activate on pressing
the Return key?</title>
NULL);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I validate/limit/filter the input to a GtkEntry?</title>
<para>If you want to validate the text that a user enters into
}
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I use horizontal scrollbars with a GtkText widget?</title>
<para>The short answer is that you can't. The current version
GtkText widget, at which time this limitation will be
removed.</para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I change the font of a GtkText widget?</title>
<para>There are a couple of ways of doing this. As GTK+ allows
font = gdk_font_load("-adobe-helvetica-medium-r-normal--*-140-*-*-*-*-*-*");
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I set the cursor position in a GtkText
object?</title>
<literal>gtk_editable_set_position()</literal>
function.</para>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>About GDK</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What is GDK?</title>
<para>GDK is basically a wrapper around the standard Xlib
<!-- Examples, anybody? I've been mulling some over. NF -->
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How do I use color allocation?</title>
<para>One of the nice things about GDK is that it's based on
}
</programlisting>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>About GLib</title>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What is GLib?</title>
<para>GLib is a library of useful functions and definitions
</listitem>
</itemizedlist>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>How can I use the doubly linked lists?</title>
<para>The GList object is defined as:</para>
<!-- Linked lists are pretty standard data structures - don't want to
over do it - TRG -->
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Memory does not seem to be released when I free the
list nodes I've allocated</title>
g_allocator_free (allocator);
</programlisting>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>Why use g_print, g_malloc, g_strdup and fellow glib
functions?</title>
<literal>gtk_print()</literal> (inside of
gtkmain.c).</quote></para>
-</sect2>
+</sect1>
<!-- ----------------------------------------------------------------- -->
-<sect2>
+<sect1>
<title>What's a GScanner and how do I use one?</title>
<para>A GScanner will tokenize your text, that is, it'll return
well, but you would have not accepted "hi 7 am 17" or "hi i hi
17".</para>
-</sect2>
-
</sect1>
+</chapter>
+
<!-- ***************************************************************** -->
-<sect1>
+<chapter>
<title>GTK+ FAQ Contributions, Maintainers and Copyright</title>
<para>If you would like to make a contribution to the FAQ, send either one
authors and maintainers of the information provided within can not
make any guarentee that the information is even accurate.</para>
-</sect1>
-
</chapter>
<!-- ----------------------------------------------------------------- -->